<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<script>
  
 $(function(){
	
	$("#updataMemberBtn").click(function(){
		var uid=$(":checkbox[name=member]:checked").val();
		var lv=$(":radio[name=level]:checked").val();
			
			if(uid==undefined){
				alert("아이디를 선택하세요 !");
				return;
			}else if(lv==undefined){
				alert("레벨을 선택하세요 !");
				return;
			}
		
		location.href="admin.do?mode=lvChange&uid="+uid+"&lv="+lv;
		});
	
	$("#leaveMemberBtn").click(function() {
		var uid = $(":checkbox[name=member]:checked").val();
		
			if (uid == undefined) {
				alert("아이디를 선택하세요 !");
				
				return;
			}
		location.href = "admin.do?mode=leave&uId=" + uid;
		alert("탈퇴성공!");
	});
	
});
</script>

<div align="center">
<input type="radio" name="level" value="0">일반회원
<input type="radio" name="level" value="99">관리자
<input type="button" value="수정하기" id="updataMemberBtn" >
<input type="button" value="탈퇴" id="leaveMemberBtn">
</div>


<table>
<tr>
	<td>선택</td>
	<td>아이디</td>
	<td>닉네임</td>
	<td>레벨</td>
</tr>
<c:forEach var="mlist" items="${requestScope.mList.list }">
<tr>
	<td><input type="checkbox" name="member" value="${mlist.uId }"></td>
	<td><a href="member.do?mode=friendMain&uid=${mlist.uId }">${mlist.id }</a></td>
	<td>${mlist.nickname}</td>
	<td>
	<c:choose>
	<c:when test="${mlist.level==0 }">일반회원</c:when>
	<c:otherwise>
	관리자
	</c:otherwise>
	</c:choose>
	</td>
</tr>
</c:forEach>

</table>